<layout name="page" />
<block name="content">
	{:widget('page_header/adv_search',array('name'=>'考勤管理','search'=>'M'))}
	<form method="post" name="form_adv_search" id="form_adv_search">
		<div class="adv_search panel panel-default  hidden"  id="adv_search">
			<div class="panel-heading">
				<div class="row">
					<h4 class="">高级搜索</h4>
					<div class="text-right">
						<a  class="btn btn-info" id="submit_adv_search">搜索</a>
						<a  class="btn " id="close_adv_search">关闭</a>
					</div>
				</div>
			</div>
			<div class="x-panel-body">
				
					<label class="input-label" for="li_name">标题：</label>
					
						<input  class="input" type="text" id="li_name" name="li_name" >
					</div>
				</div>
				
					<label class="input-label" for="li_content">内容：</label>
					
						<input  class="input" type="text" id="li_content" name="li_content" >
					</div>
				</div>
				
					<label class="input-label" for="eq_user_name">登录人：</label>
					
						<input  class="input" type="text" id="eq_user_name" name="eq_user_name" >
					</div>
				</div>
				
					<label class="input-label" for="be_create_time">登录时间：</label>
					
						<div class="input-daterange input-group" >
							<input type="text" class="input-sm input text-center" name="be_create_time" readonly="readonly"/>
							<span class="input-group-addon">-</span>
							<input type="text" class="input-sm input text-center" name="en_create_time" readonly="readonly"/>
						</div>
					</div>
				</div>
			</div>
		</div>
	</form>

	<div class="operate-panel">
		<a class="btn btn-del x-click" data-fun="del">删除</a>
		<a class="btn btn-primary x-click" data-fun="go_out">外出规则</a>
		<div class="split"></div>
		<a class="btn x-click" data-fun="shezhi">新增规则</a>
	</div>
	<div class="row">
		<form id="form_data" name="form_data" method='post'>
			<div class="">
				<div class="ul-table ul-table_responsive">
					<ul>
						<li class="thead">
							<div class="pull-left">
								<label class="inline pull-left"><span class="col-4">
										<input  type="checkbox"class="toggle-select-all" />
									</span></label>
								<span class="col-25">规则名称</span>
								<span class="col-25">考勤地点</span>
								<span class="col-25">考勤状态</span>
								<span class="col-25">签到/签退时间</span>
								<span class="col-12">操作</span>
							</div>
						</li>
						<foreach name="list" val="vo">
							<li class="tbody">
								<div class="pull-left">
									<label class="inline pull-left"><span class="col-4">
											<input  type="checkbox" name="contact_id[]" value="{$vo.id}" />
										</span></label>
									<span class="col-25"><a href="{:url('Sign/updata')}&id={$vo.id}">{$vo.name}&nbsp;&nbsp;</a></span>
									<span class="col-25">{$vo.address}&nbsp;&nbsp;</span>
									<eq name="vo.status" value="1">
										<span class="col-25">启用&nbsp;&nbsp;</span>
										<else/>
										<span class="col-25">禁用&nbsp;&nbsp;</span>
									</eq>
									<span class="col-25">{$vo.start_time}/{$vo.end_time}&nbsp;&nbsp;</span>
									<span class="col-12"><a class="x-click" data-fun="del_id" data-val="{$vo.id}">删除</a></span>
								</div>
							</li>
						</foreach>
						<div class="pagination">
							{$page}
						</div>
					</ul>
				</div>
			</div>
		</form>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;

			var active = {
				go_out : function() {
					window.open("{:url('out_rule')}", "_self");
				},

				del : function() {
					if ($("input[name='contact_id[]']:checked").length == 0) {
						layer.msg('请选择要删除的内容');
						return;
					}
					var vars = $("#form_data").serialize();
					layer.msg('确定要删除吗?', {
						time : 0,
						btn : ['确定', '取消'],
						yes : function(index) {
							send_ajax("{:url('del_index')}", vars, function(data) {
								if (data.status) {
									layer.msg(data.info, function() {
										location.reload(true);
									});
								}
							});
						},
						no : function(index) {
							layer.close(index);
						}
					});
				},

				del_id : function() {
					var id = $(this).data("val");
					layer.msg('确定要删除吗?', {
						time : 0,
						btn : ['确定', '取消'],
						yes : function(index) {
							send_ajax("{:url('Sign/del')}", "id=" + id, function(data) {
								if (data.status) {
									layer.msg(data.info, function() {
										location.reload(true);
									});
								}
							});
						},
						no : function(index) {
							layer.close(index);
						}
					});
				},

				shezhi : function() {
					send_form("form_data", "{:url('sign_set')}");
				},
			}
			$('.x-click').on('click', function() {
				var type = $(this).data('fun');
				active[type] ? active[type].call(this) : layer.msg("未定义操作");
			});
		});

	</script>
</block>
